package com.lvmama.pangolin.HBaseOper;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lvmama.pangolin.common.DateUtil;
import com.lvmama.pangolin.common.RowkeyGenerator;
import com.lvmama.pangolin.entity.lmm.LMMTicketCommodity;
import com.lvmama.pangolin.entity.lmm.LMMTicketProduct;
import com.lvmama.pangolin.entity.qnr.QNRTicketCommodityPrice;
import com.lvmama.pangolin.entity.qnr.QNRTicketProductItem;
import com.lvmama.pangolin.entity.qnr.QNRTicket_Commodity;
import com.lvmama.pangolin.entity.qnr.QNRTicket_CommodityDetail;
import com.lvmama.pangolin.hbaseutil.HBaseUtils;

@Component
public class LMMHBEntityOperation {
	/**  
	* @Title：HBEntityOperation.java
	* @Author:zhoutianqi
	* @Description:
	* @Date：2017年3月7日下午3:52:00  
	*/
	@Autowired
	private HBaseUtils hBaseUtil;
	public boolean saveLMMTicketProduct(LMMTicketProduct item,String tableName,String family){
		Map<String,String> map = new HashMap<String,String>();
		map.put("priceGrade", item.getPriceGrade());
		map.put("refundCondGrade", item.getRefundCondGrade());
		map.put("preferentialGrade", item.getPreferentialGrade());
		map.put("booktimeGrade", item.getBooktimeGrade());
		map.put("efficientGrade", item.getEfficientGrade());
		map.put("product_grade", item.getProductGrade());
		return hBaseUtil.save(map, tableName, family, item.getId());
	}
	
	public boolean saveLMMTicketCommodity(LMMTicketCommodity item,String tableName,String family){
		Map<String,String> map = new HashMap<String,String>();
		map.put("priceGrade", String.valueOf(item.getPriceGrade()));
		map.put("refundCondGrade", String.valueOf(item.getRefundCondGrade()));
		map.put("preferentialGrade", String.valueOf(item.getPreferentialGrade()));
		map.put("booktimeGrade", String.valueOf(item.getBooktimeGrade()));
		map.put("efficientGrade", String.valueOf(item.getEfficientGrade()));
		map.put("commodityGrade", item.getCommodityGrade());
		return hBaseUtil.save(map, tableName, family, item.getId());
	}
}
